Skip to content

fix: Emit plan contents in plan mode#326

Merged
benbrandt merged 1 commit into
mainfrom
surface-plan-text
Jul 22, 2026
Merged

fix: Emit plan contents in plan mode#326
benbrandt merged 1 commit into
mainfrom
surface-plan-text

Conversation

@benbrandt

Copy link
Copy Markdown
Member

Closes #307

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes missing plan visibility in ACP clients (e.g., Zed) by emitting plan item contents as standard agent_message_chunk updates, including support for plans that only arrive via item/plan/delta streaming.

Changes:

  • Handle item/plan/delta notifications by buffering streamed plan text and emitting a plan message on item/completed.
  • Emit plan thread items as agent_message_chunk updates (with messageId + Codex phase meta) in CodexAcpServer.
  • Add a dedicated Vitest suite + snapshots covering plan delta buffering, fallback behavior, and ensuring turn/plan/updated remains an ACP checklist update.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/CodexEventHandler.ts Adds handling for streamed plan deltas and emits completed plan text as an agent message chunk.
src/CodexAcpServer.ts Updates plan item rendering to use createAgentTextMessageChunk (adds messageId + meta).
src/tests/CodexACPAgent/plan-events.test.ts Adds coverage for plan delta buffering, fallbacks, and checklist plan updates.
src/tests/CodexACPAgent/data/plan-deltas.json Snapshot for completed-plan emission after receiving plan deltas.
src/tests/CodexACPAgent/data/plan-delta-fallback.json Snapshot for delta-buffer fallback when completed plan text is empty.
src/tests/CodexACPAgent/data/plan-completed-fallback.json Snapshot for completed plan emission when no deltas streamed.
src/tests/CodexACPAgent/data/plan-checklist-update.json Snapshot ensuring turn/plan/updated remains an ACP checklist update.
src/tests/CodexACPAgent/data/load-session-response-item-history-fallback.json Snapshot update for plan item history output format (messageId + meta).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/CodexEventHandler.ts
Comment on lines +115 to +116
case "item/plan/delta":
return this.createPlanDeltaEvent(notification.params);
Comment thread src/CodexEventHandler.ts
Comment on lines +303 to +304
const text = this.planDeltaTextByItemId.get(event.itemId) ?? "";
this.planDeltaTextByItemId.set(event.itemId, text + event.delta);
@benbrandt
benbrandt merged commit bae159c into main Jul 22, 2026
6 checks passed
@benbrandt
benbrandt deleted the surface-plan-text branch July 22, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan mode doesn't show Plans?

3 participants